package BubbleSort;

public class BubbleSort {
    public static void sort(int[]a){
           bubble(a,a.length-1);
    }
    private static void bubble(int[] a,int j){
        if(j == 0) {
            return;
        }
        int b = 0;
        for (int i = 0; i < j; i++) {
            if(a[i] > a[i+1]){
                int m = a[i];
                a[i] = a[i+1];
                a[i+1] = m;
                b = i;
            }
        }
        bubble(a,b);
    }
}
